(defun visual-dabbrev-expand ()
  (interactive)
  (dabbrev--reset-global-variables)
  (setq abbr (dabbrev--abbrev-at-point))
  (setq up 
        (x-popup-menu t 
                      (append '(keymap)
                              (list (concat "Expansion for " abbr))
                              (mapcar (lambda (x) (cons x (cons x  "")))
                                      (sort 
                                       (dabbrev--find-all-expansions abbr t)
                                       'string-lessp)
                                      )
                              )
                      )
        )
                                        ;(message (car up))
  (search-backward abbr)
  (replace-match (car up) t t)
)
